﻿using HtmlAgilityPack;
using System;
using System.Globalization;
using System.Windows.Data;

namespace HtmlAgilityPackAnalysis.ValueConverter
{
    public class HtmlNodeTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is HtmlNodeType type)
            {
                return type switch
                {
                    HtmlNodeType.Document => "文档的根",
                    HtmlNodeType.Element => "HTML元素",
                    HtmlNodeType.Comment => "HTML注释",
                    HtmlNodeType.Text => "文本节点",
                    _ => value,
                };
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}